//
//  CameraManager.h
//  YPC-IsBang
//
//  Created by jinbo on 2019/8/22.
//  Copyright © 2019 i4season. All rights reserved.
//

#import <Foundation/Foundation.h>
// 操作接口协议
#import "CameraOperationInterface.h"
// 设备操作回调
#import "CameraDelegate.h"
// 配置类
#import "CMConfigureHandle.h"

@class CameraManager;
#define CameraShareManager [CameraManager shareManager]
#define IFSCameraShareManager CameraShareManager

/// 设备统一方案管理类
@interface CameraManager : NSObject <CameraOperationInterface>

+ (instancetype)shareManager;

#pragma mark - CameraOperationInterface
/// 接口定义在 CameraOperationInterface.h
@property (nonatomic, strong, readonly, nullable) id<CameraOperationInterface> program;

#pragma mark - 添加/移除观察者模式
///  添加观察者
///  @param observer 观察者必须实现CameraManagerDelegate协议
- (void)addObserver:(id<CameraDelegate>)observer;

/// 删除观察者 观察者对象在准备销毁之前需要调用该方法从观察者列表移除
- (void)removeObserver:(id<CameraDelegate>)observer;

/// 初始化SDK, ⚠️ 必须调用,
- (void)startInitialize;

@end

/// 状态是否为已连接, 包括 License错误但继续的状态
static inline BOOL CMConnectIsConnected() {
    CMConnectStatus status = CameraManager.shareManager.status;
    return ((status) == CMConnectConnected || (status) == CMConnectErrorButContinue);
}
